<script setup>
import {ref} from "vue";
//子传父
const emits=defineEmits(['get-message'])

const name=ref('段平')
const sendmessage=()=>{
  //把name.value 通过父组件@get-message 传递给他
  emits('get-message',name.value)
}
</script>

<template>
<div>
  <input type="text" v-model="name" autocomplete="off" />
  <button @click="sendmessage ">send</button>
</div>
</template>

<style scoped>

</style>